a=0.35;
[X,Y]=meshgrid( 0:0.1:1);
XY=X.^2+Y.^2;
k2=4*a*X./(a^2+XY+2*a*X);
[K,E]=ellipke(k2);
aXY=a^2+XY-2*a*X;
aXY=aXY+eps*(aXY==0);
aE1=(a^2-XY)./aXY.*E;
aE2=(a^2+XY)./aXY.*E;
By=1/pi./sqrt(a^2+XY+2*a*X).*(aE1+K);
Bx=1/pi*Y./(X+eps*(X==0))./sqrt(a^2+XY+2*a*X).*(aE2-K);vy=0;
vx=0.0001:0.01:0.35;
[Vx,Vy]=meshgrid(vx,vy);
streamline(X,Y,Bx,By,Vx,Vy)
hold on
streamline(-X,Y,-Bx,By,-Vx,Vy)
streamline(-X,-Y,-Bx,-By,-Vx,-Vy)
streamline(X,-Y,Bx,-By,Vx,-Vy)
title('B的场线')
figure
subplot(2,2,1)
surf(X,Y,Bx)
title('B的x分量')
view(-130,20)
subplot(2,2,2)
contour(X,Y,Bx,10)
title('Bx的等值线')
subplot(2,2,3)
surf(x,Y,By)
title('B的y 分量')
subplot(2,2,4)
contour(X,Y,By,10)
title('By的等值线')

